# -*- coding: utf-8 -*-
from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import DeleteView, CreateView, UpdateView, FormView
from django.views import View
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponse
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required, permission_required
from django.shortcuts import redirect,render
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.contrib import messages
from django.utils.decorators import method_decorator
from .models import Wiki
from django.contrib.auth.models import User as AuthUser

# Create your views here.
class WikiListView(ListView):
    paginate_by = 20
    template_name = 'wiki/index.html'
    model = Wiki
    ordering = '-id'
    def get_context_data(self, **kwargs):
        context = super(WikiListView, self).get_context_data(**kwargs)
        context['page_key'] = 'wiki:home'
        return context

class WikiDetailView(TemplateView):
    template_name = 'wiki/detail.html'
    pass

class WikiDeleteView(DeleteView):
    template_name = 'wiki/delete.html'
    pass

class WikiNewView(TemplateView):
    template_name = 'wiki/new.html'
    def get_context_data(self, **kwargs):
        context = super(WikiNewView, self).get_context_data(**kwargs)
        context['page_key'] = 'wiki:new'
        return context
    def post(self,req):
        pass

class TestView(TemplateView):
    template_name = 'wiki/test.html'
